package cn.iocoder.yudao.module.system.dal.mysql.examscoreconversion;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.examscoreconversion.ExamScoreConversionDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 成绩换算记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ExamScoreConversionMapper extends BaseMapperX<ExamScoreConversionDO> {

    default List<ExamScoreConversionDO> selectListByStudentId(Long studentId) {
        return selectList(new LambdaQueryWrapperX<ExamScoreConversionDO>()
                .eq(ExamScoreConversionDO::getStudentId, studentId)
                .orderByDesc(ExamScoreConversionDO::getConversionDate));
    }

    default List<ExamScoreConversionDO> selectListByExamId(Long examId) {
        return selectList(new LambdaQueryWrapperX<ExamScoreConversionDO>()
                .eq(ExamScoreConversionDO::getExamId, examId)
                .orderByDesc(ExamScoreConversionDO::getConvertedScore));
    }

    default ExamScoreConversionDO selectByExamIdAndStudentId(Long examId, Long studentId) {
        return selectOne(new LambdaQueryWrapperX<ExamScoreConversionDO>()
                .eq(ExamScoreConversionDO::getExamId, examId)
                .eq(ExamScoreConversionDO::getStudentId, studentId));
    }

    default List<ExamScoreConversionDO> selectListByControlLineId(Long controlLineId) {
        return selectList(new LambdaQueryWrapperX<ExamScoreConversionDO>()
                .eq(ExamScoreConversionDO::getControlLineId, controlLineId)
                .orderByDesc(ExamScoreConversionDO::getConvertedScore));
    }

}
